package corejava2;

import java.util.LinkedList;
import java.util.Queue;

public class TestQueue2 {

    //Queue is FIFO:(First In First Out
    public static void main(String[] args) {
        Queue<Integer> q = new LinkedList<>();
        for (int i = 0; i < 10; i++) {
            q.offer(i);//入队 使用offer

        }
        while (!q.isEmpty()) {
            System.out.println(q.peek());//队头
            q.poll();//出队操作
        }
    }
}
